﻿using System.IO;
using System.Security.Principal;
using System.Web.Mvc;
using Home.Site.Models.DataLayer;
using Home.Site.Models.WebUI;

namespace Home.Site.Controllers
{
    public class HelperController : Controller
    {
        public FileStreamResult Download(string f)
        {
            var serverPath = Server.MapPath("~/Files/");
            var f2 = f.Remove(0, f.IndexOf('/'));
            var path = string.Format("{0}{1}/1920x1200/{2}.jpg", serverPath, f, f2);
            var file = new FileStream(path, FileMode.Open);

            return File(file, "image/jpeg", f2);
        }
    }
}
